package cn.hs.controller;

import cn.hs.entity.Company;
import cn.hs.pojo.CompanySelect;
import cn.hs.service.CompanyService;
import cn.hs.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName CompanyController
 * @Description TODO
 * @Author yun
 * @Date 2024年10月23日 21:30
 * @Version 1.0
 */
@RestController
@RequestMapping("/company")
public class CompanyController {

    @Autowired
    @Qualifier("companyServiceImpl")
    private CompanyService service;

    @PostMapping("/add")
    public Result add(@RequestBody Company company){
        return service.add(company);
    }

    @PostMapping("/delete")
    public Result delete(Integer id){
        return service.delete(id);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Company company){
        return service.update(company);
    }

    @GetMapping("/list")
    public Result selectAll(CompanySelect select){
        return service.selectAll(select);
    }
    @GetMapping("/selectById")
    public Result selectById(Integer id){
        return service.selectById(id);
    }

}
